package com.bj58.groupbuy.action.service.impl;

import java.util.List;

import com.bj58.groupbuy.action.db.CommonDao;
import com.bj58.groupbuy.action.db.DBConfig;
import com.bj58.groupbuy.action.model.ChinahrIndustry;
import com.bj58.groupbuy.action.service.ChinahrIndustryService;

public class ChinahrIndustryServiceImpl implements ChinahrIndustryService {

	private CommonDao comDao = new CommonDao();
	
	@Override
	public List<ChinahrIndustry> getAllCate1() throws Exception {
		StringBuffer sql = new StringBuffer();
		sql.append(" SELECT * FROM data_dict.m_common_chinahr_industry ");
		sql.append(" where cate1_id >0 ");
		sql.append(" GROUP BY cate1_name ");
		
		return comDao.getAllColsByVo(sql.toString(), ChinahrIndustry.class, DBConfig.db_131_data_bi.getIntType());
	
	}

	@Override
	public List<ChinahrIndustry> getAllCate2(String cate1_name)
			throws Exception {
		
		StringBuffer sql = new StringBuffer();
		sql.append(" SELECT * FROM data_dict.m_common_chinahr_industry ");
		sql.append(" where cate2_id >0 ");
		sql.append(" and cate1_name='"+ cate1_name+"' ");
		sql.append(" GROUP BY cate2_name ");
		
		return comDao.getAllColsByVo(sql.toString(), ChinahrIndustry.class, DBConfig.db_131_data_bi.getIntType());
	
	
	}

}
